﻿using System;
using ZilLion.Service.Core.ConfigManager.Cache;
using ZilLion.Service.Core.ConfigManager.Interface;

namespace ZilLion.Service.Core.ConfigManager.Provider
{
    /// <summary>
    ///     appconfigProvider
    /// </summary>
    internal class SysConfigProvider : IConfigProvider
    {
        public object LoadConfig()
        {
            var sysConfig = new SysConfig();
            foreach (var appkey in ConfigurationManager.AppSettings.AllKeys)
                sysConfig.AppSetting.Add(appkey.ToLower(), ConfigurationManager.AppSettings[appkey]);
            CurrentConfigInstance = sysConfig;
            return sysConfig;
        }

        public void SaveConfig(object config)
        {
        }

        public Type ConfigurationType { get; set; }
        public object CurrentConfigInstance { get; set; }

        public object RefreshConfig()
        {
            return CurrentConfigInstance;
        }
    }
}